{% extends 'html/base_template.html' %}

{% block top_script_section %}
    <script type="text/javascript">
        function do_game(flag) {
            var theForm = document.getElementById('id_game_form');
            if (flag == 0) {
                theForm.action = "{{ urls.save }}";
            } else {
                theForm.action = "{{ urls.submit }}";
            }
            theForm.method = "post";
            theForm.submit();
        }

        function show_image(obj, name) {
            var img_name = "img"+name;
            var img = $("img[name='"+img_name+"']");
            img.attr("href", obj.value);
        }

    </script>
{% endblock %}
{% load filter %}
{% block content_section %}
    {% load static %}
    <div class="row">
        <div class="col-sm-12">
            <div class="panel panel-default">
                <form role="form" class="form-horizontal" enctype="multipart/form-data" id="id_game_form">
                    <div class="panel-heading">
                        <h3 class="panel-title">创建游戏</h3>
                    </div>
                    <div class="panel-body">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><i
                                    class="cl_red">*</i>游戏名称</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="name" value="{{ game.descriptor.name }}">
                                <p>主标题，写入合同，不超过12个字符</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><i
                                    class="cl_red">*</i>游戏版本</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="version_no" value="{{ game.version_no }}">
                                <p>游戏版本号</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><i
                                    class="cl_red">*</i>版本名称</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="version_name" value="{{ game.version_name }}">
                                <p>版本名称</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><i
                                    class="cl_red">*</i>包名</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="package_name" value="{{ game.package_name }}">
                                <p>例如：com.gamestar.streetfighting</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><i class="cl_red">*</i>游戏包</label>
                            <div class="col-sm-10">
                                <input type="file" class="form-control" name="apk">
                            </div>
                        </div>
                    </div>
                    <div id="id_game_info_section">
                        <div class="panel-heading">
                            <h3 class="panel-title">游戏信息</h3>
                        </div>
                        <div class="panel-body">
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i
                                        class="cl_red">*</i>公司名称</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" name="company" value="{{ game.descriptor.company }}">
                                    <p>请填写公司全称</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i
                                        class="cl_red">*</i>游戏题材及IP</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" name="subject" value="{{ game.descriptor.subject }}">
                                    <p>请填写游戏使用的题材（含IP），例如三国，西游等等</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i
                                        class="cl_red">*</i>游戏基础分类</label>
                                <div class="col-sm-10">
                                    <ul class="dowebok">
                                        {% for value, title in GameType.Types %}
                                            {% if game.descriptor.type == value %}
                                                <li><input type="radio"
                                                           name="type"
                                                           checked="checked"
                                                           value="{{ value }}"
                                                           data-labelauty="{{ title }}"></li>
                                            {% else %}
                                                <li><input type="radio"
                                                           name="type"
                                                           value="{{ value }}"
                                                           data-labelauty="{{ title }}"></li>
                                            {% endif %}
                                        {% endfor %}
                                    </ul>
                                    <p>仅限选择一项</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i
                                        class="cl_red">*</i>资费模式</label>
                                <div class="col-sm-10">
                                    <ul class="dowebok">
                                        {% for value, title in GamePayMode.PayModes %}
                                            {% if value == game.descriptor.paymode %}
                                                <li><input type="radio" name="paymode"
                                                           checked="checked"
                                                           data-labelauty="{{ title }}"
                                                           value="{{ value }}"></li>
                                            {% else %}
                                                <li><input type="radio" name="paymode"
                                                       data-labelauty="{{ title }}"
                                                       value="{{ value }}"></li>
                                            {% endif %}
                                        {% endfor %}
                                    </ul>
                                    <p>仅限选择一项</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i
                                        class="cl_red">*</i>操作方式</label>
                                <div class="col-sm-10">
                                    <ul class="dowebok">
                                        {% for value, title in GameOpMode.OpModes %}
                                            {% if value|bits_and:game.descriptor.opmodes.0 %}
                                                <li><input type="checkbox"
                                                           checked="checked"
                                                           name="opmodes"
                                                           data-labelauty="{{ title }}"
                                                           value="{{ value }}"></li>
                                            {% else %}
                                                <li><input type="checkbox" name="opmodes"
                                                           data-labelauty="{{ title }}"
                                                           value="{{ value }}"></li>
                                            {% endif %}
                                        {% endfor %}
                                    </ul>
                                    <p>可多选</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i
                                        class="cl_red">*</i>游戏品类</label>
                                <div class="col-sm-10">
                                    <ul class="dowebok">
                                        {% for value, title in GameCategory.Categories %}
                                            {% if value == game.descriptor.category %}
                                                <li><input type="radio"
                                                           checked="checked"
                                                           name="category"
                                                           data-labelauty="{{ title }}"
                                                           value="{{ value }}"></li>
                                            {% else %}
                                                <li><input type="radio"
                                                           name="category"
                                                           data-labelauty="{{ title }}"
                                                           value="{{ value }}"></li>
                                            {% endif %}
                                        {% endfor %}
{#                                        <li><input type="radio" name="categories"#}
{#                                                   data-labelauty="RPG" value="1"></li>#}
{#                                        <li><input type="radio" name="categories"#}
{#                                                   data-labelauty="棋牌桌游" value="2"></li>#}
{#                                        <li><input type="radio" name="categories"#}
{#                                                   data-labelauty="亲子互动" value="4"></li>#}
{#                                        <li><input type="radio" name="categories"#}
{#                                                   data-labelauty="动作冒险" value="8"></li>#}
{#                                        <li><input type="radio" name="categories"#}
{#                                                   data-labelauty="经典怀旧" value="16"></li>#}
{#                                        <li><input type="radio" name="categories"#}
{#                                                   data-labelauty="操作达人" value="32"></li>#}
{#                                        <li><input type="radio" name="categories"#}
{#                                                   data-labelauty="竞速飞行" value="64"></li>#}
{#                                        <li><input type="radio" name="categories"#}
{#                                                   data-labelauty="休闲益智" value="128"></li>#}
{#                                        <li><input type="radio" name="categories"#}
{#                                                   data-labelauty="其他" value="256"></li>#}
                                    </ul>
                                    <p>仅限选择一项</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i
                                        class="cl_red">*</i>游戏风格</label>
                                <div class="col-sm-10">
                                    <ul class="dowebok">
                                        {% for value, title in GameStyle.Styles %}
                                            {% if value|bits_and:game.descriptor.styles.0 %}
                                                <li><input type="checkbox"
                                                           name="styles"
                                                           checked="checked"
                                                           value="{{ value }}"
                                                           data-labelauty="{{ title }}"></li>
                                            {% else %}
                                                <li><input type="checkbox"
                                                           name="styles"
                                                           value="{{ value }}"
                                                           data-labelauty="{{ title }}"></li>
                                            {% endif %}
                                        {% endfor %}
                                    </ul>
                                    <p>可多选,最多可选三项</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i
                                        class="cl_red">*</i>游戏介绍</label>
                                <div class="col-sm-10">
                                    <textarea name="description" class="form-control">{{ game.description }}</textarea>
                                    <p>介绍游戏的内容、特色、优势等，限300字以内</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i
                                        class="cl_red">*</i>发布时间</label>
                                <div class="col-sm-10">
                                    <ul class="dowebok">
                                        {% for value, title in GameReleaseMode.ReleaseModes %}
                                            <li><input type="radio" name="release_mode" checked=""
                                                       data-labelauty="{{ title }}"
                                                       value="{{ value }}"></li>
                                        {% endfor %}
                                    </ul>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i
                                        class="cl_red">*</i>游戏ICON</label>
                                <div class="col-sm-10">
                                    <input type="file" class="form-control" name="img_icon">
                                    <p>支持PNG格式，重新上传将替换旧图标，请上传190*190的图标</p>
                                    <div class="upload_img w_80">
                                        <img src="{{ game.img_icon|download_url }}">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i
                                        class="cl_red">*</i>游戏封面</label>
                                <div class="col-sm-10">
                                    <input type="file" class="form-control" name="img_cover">
                                    <p>支持PNG格式，重新上传将替换旧图标，请上传490*368的封面图</p>
                                    <div class="upload_img w_105">
                                        <img src="{{ game.img_cover | download_url }}">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i
                                        class="cl_red">*</i>游戏宣传图</label>
                                <div class="col-sm-10">
                                    <input type="file" class="form-control" name="img_poster">
                                    <p>支持PNG格式，重新上传将替换旧图标，请上传1068*600的宣传图</p>
                                    <div class="upload_img w_142">
                                        <img src="{{ game.img_poster|download_url }}">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i
                                        class="cl_red">*</i>游戏截图</label>
                                <div class="col-sm-10">
                                    <a class="fide_but">批量上传</a>
                                    <input type="file" multiple name="img_screenshots">
                                    <p>支持PNG格式，尺寸为1196*674,至少上传4张，最多可上传5张</p>
                                    <div class="upload_img w_142">
                                        <img src="{% static "images/img_icon04.png" %}">
                                        <img src="{% static "images/img_icon04.png" %}">
                                        <img src="{% static "images/img_icon04.png" %}">
                                        <img src="{% static "images/img_icon04.png" %}">
                                        <img src="{% static "images/img_icon04.png" %}">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="panel-heading">
                            <h3 class="panel-title">版权认证</h3>
                        </div>
                        <div class="panel-body">
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i
                                        class="cl_red">*</i>软件著作权证书</label>
                                <div class="col-sm-10">
                                    <input type="file" class="form-control" name="ca_copyright">
                                    <p>所创建游戏已获取软件著作权证书，请务必上传电子扫描件，支持JPEG、JPG、PNG格式。</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i
                                        class="cl_red">*</i>与玩吧合作授权书</label>
                                <div class="col-sm-10">
                                    <input type="file" class="form-control" name="ca_agreement">
                                    <p>开发者授权玩吧游戏平台代理运营，请务必上传电子扫描件，支持JPEG、JPG、PNG格式。</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">代理授权书</label>
                                <div class="col-sm-10">
                                    <input type="file" class="form-control" name="ca_agency">
                                    <p> 若游戏为他人授权代理运营，需在此处上传电子扫描件，支持JPEG、JPG、PNG格式。</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">其他补充材料</label>
                                <div class="col-sm-10">
                                    <input type="file" class="form-control" name="ca_others">
                                    <p>所创建游戏已具备资质认证所需的其他材料，需在此处上传，支持ZIP等格式。</p>
                                </div>
                            </div>
                        </div>
                        <div class="row my_button">
                            <div class="col-xs-6">
                                <button class="btn btn-info btn-block my_btn_02" type="submit" name="btn_save_game" onclick="do_game(0);">保存草稿
                                </button>
                            </div>
                            <div class="col-xs-6">
                                <button type="submit"
                                        class="btn btn-info btn-block my_btn_03" name="btn_submit_game" onclick="do_game(1);">提交审核
                                </button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
{% endblock %}
